#include "ros/ros.h"
#include "tf2_ros/transform_listener.h"
#include "tf2_ros/buffer.h"
#include "geometry_msgs/PointStamped.h"
#include "tf2_geometry_msgs/tf2_geometry_msgs.h"//must include this head file while using transform
int main(int argc, char *argv[])
{       
        setlocale(LC_ALL, "");
        ros::init(argc,argv,"static_sub");
        ros::NodeHandle nd;
 
        tf2_ros::Buffer buff;
        tf2_ros::TransformListener lis(buff);
        
        geometry_msgs::PointStamped ps;
         ps.header.frame_id = "laser";
        ps.header.stamp = ros::Time::now();
        ps.point.x = 2.0;
        ps.point.y = 2.0;
        ps.point.z = 2.0;

        ros::Duration(2).sleep();
        ros::Rate rate(10);

        while (ros::ok())
        {
                geometry_msgs::PointStamped ps_out =  buff.transform(ps ,"base_link");

                ROS_INFO("ps_out %.2f,%.2f,%.2f,frame:%s",
                                        ps_out.point.x,
                                        ps_out.point.y,
                                        ps_out.point.z,
                                        ps_out.header.frame_id.c_str());
                rate.sleep();
                ros::spinOnce();
        }
        
        return 0;
}